#include "list_api.h"

BOOL CALLAPI JOUI::ExList::Layout_Init(INT nType)
{
	return UIList::Layout_Init(nType);
}

BOOL CALLAPI JOUI::ExList::Layout_Update()
{
	return UIList::Layout_Update();
}

INT CALLAPI JOUI::ExList::Layout_GetType()
{
	return UIList::Layout_GetType();
}

BOOL CALLAPI JOUI::ExList::Layout_SetChildProp(LPVOID parent, INT dwPropID, size_t pvValue)
{
	return UIList::Layout_SetChildProp((UIControl*)parent, dwPropID, pvValue);
}

BOOL CALLAPI JOUI::ExList::Layout_SetProp(INT dwPropID, size_t pvValue)
{
	return UIList::Layout_SetProp(dwPropID, pvValue);
}

BOOL CALLAPI JOUI::ExList::Layout_Absolute_Lock(LPVOID hObjChild, INT tLeft, INT tTop, INT tRight, INT tBottom, INT tWidth, INT tHeight)
{
	return UIList::Layout_Absolute_Lock((UIControl*)hObjChild, tLeft, tTop, tRight, tBottom, tWidth, tHeight);
}

BOOL CALLAPI JOUI::ExList::Layout_Absolute_Setedge(LPVOID hObjChild, INT dwEdge, INT dwType, size_t nValue)
{
	return UIList::Layout_Absolute_Setedge((UIControl*)hObjChild, dwEdge, dwType, nValue);
}

BOOL CALLAPI JOUI::ExList::Layout_AddChild(LPVOID parent)
{
	return UIList::Layout_AddChild((UIControl*)parent);
}

BOOL CALLAPI JOUI::ExList::Layout_AddChildren(BOOL fDesc, LPCWSTR dwObjClass, INT* nCount)
{
	return UIList::Layout_AddChildren(fDesc, dwObjClass, nCount);
}

BOOL CALLAPI JOUI::ExList::Layout_DeleteChild(LPVOID parent)
{
	return UIList::Layout_DeleteChild((UIControl*)parent);
}

BOOL CALLAPI JOUI::ExList::Layout_DeleteChildren(LPCWSTR dwObjClass)
{
	return UIList::Layout_DeleteChildren(dwObjClass);
}
void CALLAPI JOUI::ExList::InitSubControl(LPVOID hParent, INT x, INT y, INT width, INT height, LPCWSTR lpClsname, LPCWSTR lpszName, INT dwStyle, INT dwStyleEx, INT nID,
	INT dwTextFormat, LPARAM lParam, ClsPROC pfnClsProc)
{
	UIBase* pObj = (UIControl*)hParent;
	if (!pObj)
		pObj = (UIWnd*)hParent;
	UIControl::InitSubControl(pObj, x, y, width, height, lpClsname, lpszName, dwStyle, dwStyleEx, nID, dwTextFormat, lParam, pfnClsProc);
}

LPVOID CALLAPI JOUI::ExList::GetHandle()
{
	return UIControl::GetParent(TRUE);
}

void CALLAPI JOUI::ExList::Move(INT x, INT y, INT width, INT height, BOOL bRepaint)
{
	UIControl::Move(x, y, width, height, bRepaint);
}

void CALLAPI JOUI::ExList::SetPos(INT x, INT y, INT width, INT height, HWND hObjInsertAfter, INT flags)
{
	if (flags == 0)
		flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE;
	UIControl::SetPos(x, y, width, height, hObjInsertAfter, flags);
}

void CALLAPI JOUI::ExList::Redraw(RECT* lprcRedraw)
{
	UIControl::Redraw(lprcRedraw);
}

BOOL CALLAPI JOUI::ExList::BeginPaint(ps_context& lpPS)
{
	return UIControl::BeginPaint(lpPS);
}

void CALLAPI JOUI::ExList::EndPaint()
{
	UIControl::EndPaint();
}

void CALLAPI JOUI::ExList::Show(BOOL fShow)
{
	UIControl::Show(fShow);
}

BOOL CALLAPI JOUI::ExList::IsVisible()
{
	return UIControl::IsVisible();
}

void CALLAPI JOUI::ExList::Enable(BOOL fEnable)
{
	UIControl::Enable(fEnable);
}

BOOL CALLAPI JOUI::ExList::IsEnable()
{
	return UIControl::IsEnable();
}

BOOL CALLAPI JOUI::ExList::SetFocus()
{
	return UIControl::SetFocus();
}

LPVOID CALLAPI JOUI::ExList::GetFocus()
{
	return UIControl::GetFocus();
}

void CALLAPI JOUI::ExList::KillFocus()
{
	UIControl::KillFocus();
}

BOOL CALLAPI JOUI::ExList::SetText(LPCWSTR lpString)
{
	return UIControl::SetText(lpString);
}

void CALLAPI JOUI::ExList::GetText(LPCWSTR& lpString)
{
	lpString = UIControl::GetText();

}

INT CALLAPI JOUI::ExList::SetTextFormat(DWORD dwTextFormat, BOOL bRedraw)
{
	return UIControl::SetTextFormat(dwTextFormat, bRedraw);
}

void CALLAPI JOUI::ExList::SetPadding(INT left, INT top, INT right, INT bottom, BOOL fRedraw)
{
	UIControl::SetPadding(left, top, right, bottom, fRedraw);
}

void CALLAPI JOUI::ExList::SetTipsText(LPCWSTR lpString, INT crBlack, INT crText)
{
	UIControl::SetTipsText(lpString, crBlack, crText);
}

void CALLAPI JOUI::ExList::TooltipsPop(LPCWSTR lpTitle, LPCWSTR lpText, INT crBlack, INT crText, INT x, INT y, INT dwTime, INT nIcon, BOOL fShow)
{
	UIControl::TooltipsPop(lpTitle, lpText, crBlack, crText, x, y, dwTime, nIcon, fShow);
}

size_t CALLAPI JOUI::ExList::DispatchNotify(INT nCode, WPARAM wParam, LPARAM lParam)
{
	return UIControl::DispatchNotify(nCode, wParam, lParam);
}

size_t CALLAPI JOUI::ExList::SendMsg(INT uMsg, WPARAM wParam, LPARAM lParam)
{
	return UIControl::SendMsg(uMsg, wParam, lParam);
}

BOOL CALLAPI JOUI::ExList::SetEvent(INT nEvent, EventHandlerPROC pfnCallback)
{
	return UIControl::SetEvent(nEvent, pfnCallback);
}

void CALLAPI JOUI::ExList::SetMsgProc(ObjMsgPROC pfnCallback)
{
	UIControl::SetMsgProc(pfnCallback);
}

void CALLAPI JOUI::ExList::SetState(DWORD dwState, BOOL fRemove, RECT* lprcRedraw, BOOL fRedraw)
{
	UIControl::SetState(dwState, fRemove, lprcRedraw, fRedraw);
}

INT CALLAPI JOUI::ExList::GetState()
{
	return UIControl::GetState();
}

BOOL CALLAPI JOUI::ExList::GetRect(RECT& lpRect, INT nType, BOOL fScale)
{
	return UIControl::GetRect(lpRect, nType, fScale);
}

LPVOID CALLAPI JOUI::ExList::GetNode(INT nCmd)
{
	return UIControl::GetNode(nCmd);
}

void CALLAPI JOUI::ExList::GetColor(INT nIndex, INT& rel)
{
	UIColor dwColor;
	UIControl::GetColor(nIndex, dwColor);
	rel = dwColor.GetARGB();
}

BOOL CALLAPI JOUI::ExList::SetColor(INT nIndex, INT dwColor, BOOL fRedraw)
{
	return UIControl::SetColor(nIndex, dwColor, fRedraw);
}

LPVOID CALLAPI JOUI::ExList::GetFromUIWnd()
{
	return UIControl::GetUIWnd();
}

HWND CALLAPI JOUI::ExList::GethWnd()
{
	return UIControl::GethWnd();
}

void CALLAPI JOUI::ExList::SetParent(LPVOID hParent)
{
	UIBase* pObj = (UIControl*)hParent;
	if (!pObj)
		pObj = (UIWnd*)hParent;
	UIControl::SetParent(pObj);
}

LPVOID CALLAPI JOUI::ExList::GetParent(BOOL tParent)
{
	return UIControl::GetParent(tParent);
}

LPVOID CALLAPI JOUI::ExList::GetParentUIWnd()
{
	return UIControl::GetParentUIWnd();
}

void CALLAPI JOUI::ExList::GetlClassName(LPCWSTR& lpClassName)
{
	lpClassName = UIControl::GetlClassName();
}

void CALLAPI JOUI::ExList::SetRadius(FLOAT topleft, FLOAT topright, FLOAT bottomright, FLOAT bottomleft, BOOL fUpdate)
{
	UIControl::SetRadius(topleft, topright, bottomright, bottomleft, fUpdate);
}

BOOL CALLAPI JOUI::ExList::SetFontFromFamily(LPCWSTR lpszFontfamily, INT dwFontsize, INT dwFontstyle, BOOL fRedraw)
{
	return UIControl::SetFontFromFamily(lpszFontfamily, dwFontsize, dwFontstyle, fRedraw);
}

BOOL CALLAPI JOUI::ExList::SetFontLogFont(LOGFONTW* Fontinfo, BOOL fRedraw)
{
	return UIControl::SetFontLogFont(Fontinfo, fRedraw);
}

UIfont CALLAPI JOUI::ExList::GetFont()
{
	return UIControl::GetFont();
}

BOOL CALLAPI JOUI::ExList::SetBackgImageFromMemory(LPVOID lpImage, size_t dwImageLen, INT x, INT y, DWORD dwRepeat, RECT* lpGrid, INT dwFlags, DWORD dwAlpha)
{
	return UIControl::SetBackgImage(lpImage, dwImageLen, x, y, dwRepeat, lpGrid, dwFlags, dwAlpha);
}

BOOL CALLAPI JOUI::ExList::SetBackgImageFromHandle(UIimage* hImage, BOOL fReset, INT x, INT y, DWORD dwRepeat, RECT* lpGrid, INT dwFlags, DWORD dwAlpha)
{
	return UIControl::SetBackgImage((UIImage*)hImage, fReset, x, y, dwRepeat, lpGrid, dwFlags, dwAlpha);
}

BOOL CALLAPI JOUI::ExList::SetBackgImageFromFile(LPCWSTR lpImagefile, INT x, INT y, DWORD dwRepeat, RECT* lpGrid, INT dwFlags, DWORD dwAlpha)
{
	return UIControl::SetBackgImage(lpImagefile, x, y, dwRepeat, lpGrid, dwFlags, dwAlpha);
}

void CALLAPI JOUI::ExList::SetBackgInfo(INT x, INT y, RECT* lpGrid, INT dwFlags, DWORD dwAlpha)
{
	UIControl::SetBackgInfo(x, y, lpGrid, dwFlags, dwAlpha);
}

BOOL CALLAPI JOUI::ExList::SetBackgPlay(BOOL fPlayFrames, BOOL fResetFrame)
{
	return UIControl::SetBackgPlay(fPlayFrames, fResetFrame);
}

void CALLAPI JOUI::ExList::SetBlur(FLOAT fDeviation, BOOL fmodesoft, BOOL bRedraw)
{
	UIControl::SetBlur(fDeviation, fmodesoft, bRedraw);
}

BOOL CALLAPI JOUI::ExList::SetTimer(UINT uTimeout)
{
	return UIControl::SetTimer(uTimeout);
}

BOOL CALLAPI JOUI::ExList::KillTimer()
{
	return UIControl::KillTimer();
}

void CALLAPI JOUI::ExList::SetAlpha(INT fAlpha)
{
	UIControl::SetAlpha(fAlpha);
}

void CALLAPI JOUI::ExList::SetID(INT nID)
{
	UIControl::SetID(nID);
}

INT CALLAPI JOUI::ExList::GetID()
{
	return UIControl::GetID();
}

LPARAM CALLAPI JOUI::ExList::GetlParam()
{
	return UIControl::GetlParam();
}

void CALLAPI JOUI::ExList::SetlParam(LPARAM dwlParam)
{
	UIControl::SetlParam(dwlParam);
}

INT CALLAPI JOUI::ExList::Style(INT dwStyle)
{
	return UIControl::Style(dwStyle);
}

INT CALLAPI JOUI::ExList::StyleEx(INT dwStyleEx)
{
	return UIControl::StyleEx(dwStyleEx);
}

BOOL CALLAPI JOUI::ExList::GetScrollInfo(BOOL bHScroll, INT& lpnMin, INT& lpnMax, INT& lpnPos, INT& lpnTrackPos)
{
	return UIControl::GetScrollInfo(bHScroll, lpnMin, lpnMax, lpnPos, lpnTrackPos);
}

INT CALLAPI JOUI::ExList::SetScrollInfo(BOOL bHScroll, INT Mask, INT nMin, INT nMax, INT nPage, INT nPos, BOOL bRedraw)
{
	return UIControl::SetScrollInfo(bHScroll, Mask, nMin, nMax, nPage, nPos, bRedraw);
}

INT CALLAPI JOUI::ExList::GetScrollPos(BOOL bHScroll)
{
	return UIControl::GetScrollPos(bHScroll);
}

INT CALLAPI JOUI::ExList::SetScrollPos(BOOL bHScroll, INT nPos, BOOL bRedraw)
{
	return UIControl::SetScrollPos(bHScroll, nPos, bRedraw);
}

INT CALLAPI JOUI::ExList::SetScrollRange(BOOL bHScroll, INT nMin, INT nMax, BOOL bRedraw)
{
	return UIControl::SetScrollRange(bHScroll, nMin, nMax, bRedraw);
}

BOOL CALLAPI JOUI::ExList::GetScrollRange(BOOL bHScroll, INT& lpnMinPos, INT& lpnMaxPos)
{
	return UIControl::GetScrollRange(bHScroll, lpnMinPos, lpnMaxPos);
}

INT CALLAPI JOUI::ExList::GetScrollTrackPos(BOOL bHScroll)
{
	return UIControl::GetScrollTrackPos(bHScroll);
}

void CALLAPI JOUI::ExList::SetScrollShow(BOOL bHScroll, BOOL fShow)
{
	UIControl::SetScrollShow(bHScroll, fShow);
}

void CALLAPI JOUI::ExList::SetScrollEnable(INT wSB, INT wArrows)
{
	UIControl::SetScrollEnable(wSB, wArrows);
}

void CALLAPI JOUI::ExList::SetScrollColor(INT color_normal, INT color_hover, INT color_down, INT color_btn_up, INT color_btn_down, BOOL bRedraw)
{
	UIControl::SetScrollColor(color_normal, color_hover, color_down, color_btn_up, color_btn_down, bRedraw);
}

void CALLAPI JOUI::ExList::SetScrollRadius(BOOL bRadius)
{
	UIControl::SetScrollRadius(bRadius);
}

INT CALLAPI JOUI::ExList::PostScrollMsg(INT uMsg, WPARAM wParam, LPARAM lParam, INT nLine)
{
	return UIControl::PostScrollMsg(uMsg, wParam, lParam, nLine);
}

void CALLAPI JOUI::ExList::SetCursor(HCURSOR fCursor)
{
	UIControl::SetCursor(fCursor);
}

HRESULT CALLAPI JOUI::ExList::ToImage(UIimage& dstImg, BOOL cdraw)
{
	return UIControl::ToImage((UIImage**)dstImg, cdraw);
}

HRESULT CALLAPI JOUI::ExList::CheckDropFormat(LPVOID pDataObject, DWORD dwFormat)
{
	return UIControl::CheckDropFormat(pDataObject, dwFormat);
}

INT CALLAPI JOUI::ExList::CheckDropString(LPVOID pDataObject, LPWSTR lpwzBuffer, INT cchMaxLength)
{
	return UIControl::CheckDropString(pDataObject, lpwzBuffer, cchMaxLength);
}

UINT CALLAPI JOUI::ExList::CheckDropFileNumber(WPARAM wParam)
{
	return UIControl::CheckDropFileNumber(wParam);
}

UINT CALLAPI JOUI::ExList::CheckDragQueryFile(WPARAM wParam, UINT iFile, LPWSTR lpszFile, UINT cch)
{
	return UIControl::CheckDragQueryFile(wParam, iFile, lpszFile, cch);
}

BOOL CALLAPI JOUI::ExList::Lock(INT Left, INT Top, INT Right, INT Bottom, INT Width, INT Height)
{
	return UIControl::Lock(Left, Top, Right, Bottom, Width, Height);
}

LPVOID CALLAPI JOUI::ExList::FindUIView(LPCWSTR lpName)
{
	return UIControl::FindUIView(lpName);
}
JOUI::ExList::~ExList()
{
}

INT JOUI::ExList::AddItem(LPCWSTR pwzText, UIimage nImage, INT index, bool draw)
{
	return UIList::AddItem(pwzText, (UIImage*)nImage, index, draw);
}

void JOUI::ExList::SetItem(INT index, LPCWSTR pwzText, UIimage nImage, bool draw)
{
	UIList::SetItem(index, pwzText, (UIImage*)nImage, draw);
}

INT JOUI::ExList::DeleteItem(INT index, bool draw)
{
	return UIList::DeleteItem(index, draw);
}

void JOUI::ExList::DeleteAllItem()
{
	UIList::DeleteAllItem();
}

void JOUI::ExList::Update()
{
	UIList::Update();
}

void JOUI::ExList::SetCrHot(INT hover, INT checked, INT down)
{
	UIList::SetCrHot(hover, checked, down);
}

BOOL JOUI::ExList::GetItem(int index, LPCWSTR& pwzText, UIimage& nImage)
{
	ListItem* item = nullptr;
	if (UIList::GetItem(index, &item))
	{
		pwzText = item->text;
		nImage = item->nImage;
		return TRUE;
	}
	return FALSE;
}

INT JOUI::ExList::GetItemCount()
{
	return UIList::GetItemCount();
}


BOOL JOUI::IUIListCreate(IUIList** r_IControl, LPVOID hParent, INT x, INT y, INT width, INT height, INT dwStyle, INT dwStyleEx, INT nID, INT dwTextFormat)
{
	UIBase* pObj = (UIWnd*)hParent;
	if (pObj->m_UIWindow == nullptr)
		pObj = (UIControl*)hParent;

	ExAutoPtr<ExList> OfThis = new ExList(pObj, x, y, width, height, dwStyle, dwStyleEx, nID, dwTextFormat);
	return OfThis->QueryInterface(r_IControl) == S_OK;
}
